"""
Choice
======
"""
from wxpita import *

genres = 'Country', 'Pop', 'Hip Hop', 'Rock', 'Jazz', 'Metal', 'Classical'

f = SizedFrame [
    Choice(name='chc1', choices=genres),
    Choice(name='chc2'),

    TextCtrl(name='log', style='te_multiline', expand=True, proportion=1),
]

@f.Init
def _():
    f.chc1.SetSelection(3)
    
    for s in ['Cow', 'Chicken', 'Pig', 'Horse', 'Mule', 'Donkey', 'Ox']:
        f.chc2.Append(s)

@f.chc1.choice_selected
@f.chc2.choice_selected
def _(evt):
    choice = evt.EventObject
    mesg = 'You selected "%s" in <%s>\n' % (
        choice.GetString(choice.GetSelection()), choice.GetName())
    f.log.AppendText(mesg)

f.Show('Choice Example', size=(300,300))
